import os
import time

with open(b"C:\\Users\\sihao\\Documents\\test.log", "a+") as f:
    while 1:
        f.write(str(time.time()) + "\r\n")
        f.flush()
        time.sleep(5)